

-- Namespace
	local _,mod = ...


-- Object ref
	local RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS


-- Constants
	local font = {mod.path..'media\\bavaria.ttf',8,'OUTLINEMONOCHROME'}
	
	local c_bar =    {.16,.16,.16}
	local c_barbg =  {.33,.33,.33}
	local c_border = {.07,.07,.07}
	
	local white = { r = 1, g = 1, b = 1 }
	
	local _,class = UnitClass('player')
	
	local player = mod:UF('player')
	local target = mod:UF('target')


-- Druid mana
	if class == 'DRUID' then
		local manatick = player:CreateTexture(nil,'ARTWORK')
			manatick:SetZLevel(1)
			manatick:SetHeight(2) manatick:SetWidth(3)
			manatick:Hide()
			manatick:SetTexture(.5,.5,1)
			manatick:Listen('mana',function(self,min,max)
				if min then
					self:Show()
					local perc = min / max
					if perc <= 0 then
						perc = .001
					elseif perc > 1 then
						perc = 1
					end
					self:ClearAllPoints()
					self:SetPoint('BOTTOMRIGHT',-1,1+126*perc)
				else
					self:Hide()
				end
			end)
			player.manatick = manatick
	end


-- Combo points
	if class == 'DRUID' or class == 'ROGUE' then
		for i = 1,5 do
			local id = i
			
			local cpN = target:CreateTexture(nil,'BORDER')
				cpN:SetHeight(5) cpN:SetWidth(5)
				cpN:SetPoint('BOTTOMLEFT',target,'BOTTOMRIGHT',5,1+((i-1)*11))
				cpN:Hide()
				cpN:SetTexture(.6,.2,.2)
				cpN:Listen('combopoints',function(self,cp)
					if cp >= id then
						self:Show()
					else
						self:Hide()
					end
				end)
				target['cp'..i] = cpN
			
			local cpNbg = target:CreateTexture(nil,'BACKGROUND')
				cpNbg:SetHeight(7) cpNbg:SetWidth(7)
				cpNbg:SetPoint('BOTTOMLEFT',target,'BOTTOMRIGHT',4,0+((i-1)*11))
				cpNbg:Hide()
				cpNbg:SetTexture(0,0,0)
				cpNbg:Listen('combopoints',function(self,cp)
					if cp >= id then
						self:Show()
					else
						self:Hide()
					end
				end)
				target['cp'..i..'bg'] = cpNbg
		end
	end


-- Anticipation chargs
	if class == 'ROGUE' then
		for i = 1,5 do
			local id = i
			
			local cpN = player:CreateTexture(nil,'BORDER')
				cpN:SetHeight(5) cpN:SetWidth(5)
				cpN:SetPoint('TOPRIGHT',player,'TOPLEFT',-5,-1-((i-1)*11))
				cpN:Hide()
				cpN:SetTexture(.5,.5,.5)
				cpN:Listen('anticipation',function(self,cp)
					if cp >= id then
						self:Show()
					else
						self:Hide()
					end
				end)
				player['acp'..i] = cpN
			
			local cpNbg = player:CreateTexture(nil,'BACKGROUND')
				cpNbg:SetHeight(7) cpNbg:SetWidth(7)
				cpNbg:SetPoint('TOPRIGHT',player,'TOPLEFT',-4,0-((i-1)*11))
				cpNbg:Hide()
				cpNbg:SetTexture(0,0,0)
				cpNbg:Listen('anticipation',function(self,cp)
					if cp >= id then
						self:Show()
					else
						self:Hide()
					end
				end)
				player['acp'..i..'bg'] = cpNbg
		end
	end
